import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue';
import { baseCfg, pluginCfg } from "./rs-config";
// https://rsbuild.dev/zh/guide/start/index
export default defineConfig(async ({ env, command, envMode }) => {
  const PUBLIC_BASE_URL = process.env.PUBLIC_BASE_URL
  console.log(PUBLIC_BASE_URL)
  const pluginMap = await pluginCfg({ env, command, envMode, PUBLIC_BASE_URL })
  return {
    ...baseCfg({ env, command, envMode, PUBLIC_BASE_URL }),
    plugins: [pluginVue(), ...pluginMap.plugins],
    tools: {
      rspack: {
        // Rspack 或 Webpack 插件
        plugins: [...pluginMap.rspackPlugin],
      },
    },
  }
});
